<!--垫资服务-->
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" href="../../libs/mui.min.css"/>
    <link rel="stylesheet" href="../../libs/app.css"/>
    <link rel="stylesheet" href="../../css/mui.listpicker.css"/>
    <link rel="stylesheet" href="../../css/mui.poppicker.css"/>
    <link rel="stylesheet" href="../../css/main.css"/>
    <link rel="stylesheet" href="../../css/askfor.css"/>
</head>
<body>
<div class="head">
    <img class="mui-action-back" src="../../images/all-left.png" alt="">
    <p>申请信息</p>
</div>
<div class="context2">
    <div class="state">
        <div><span class="one">1</span>
            <p>申请人信息</p>
        </div>
        <div>

        </div>
        <div><span class="three">2</span>
            <p>申请结果</p>
        </div>
        <img class="gang3" src="../../images/white-gang.png" alt="">
    </div>
    <div class="message">
        <div>
            <p>姓名</p>
            <input class="name" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>身份证号</p>
            <input class="card" type="text" placeholder="单行输入">
        </div>

        <div>
            <p>贷款金额</p><span>万元</span>
            <input class="price" type="text" placeholder="单行输入">
        </div>
        <div>
            <p>贷款期限</p>
            <select id="date">
                <option value="">请选择</option>
                <option value="10天">10天</option>
                <option value="15天">15天</option>
                <option value="30天">30天</option>
                <option value="60天">60天</option>
            </select>
        </div>
        <div id='showCityPicker3' class="mui-btn mui-btn-block">
            <p>申请地点</p>
            <i class="icon-editCity"></i>
            <input readonly="true" id='cityResult3' class="ui-alert area" placeholder="请选择" type="text"/>
        </div>

    </div>
    <!--<div class="yan">
        <div class="yan-input"><input type="text" placeholder=""></div>
        <div><button>获取验证码</button></div>
        <img src="../../images/yan.png" alt="">
    </div>-->
    <div class="button">
        <button id="askfor3">下一步</button>
    </div>
</div>

<script src="../../js/jquery-3.1.1.min.js"></script>
<script src="../../libs/mui.min.js"></script>
<script src="../../js/url.js"></script>
<script src="../../js/city-data-3.js"></script>
<script src="../../js/mui.listpicker.js"></script>
<script src="../../js/mui.poppicker.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=AIEts6CoFGpdivbIz3uI3SrAG9iDB0Ko"></script>
<script src="../../js/location.js"></script>
<script src="../../js/city-public.js"></script>
<script>
    //接口
    $('#askfor3').on('tap', function () {
        var name = $('.name').val();
        var card = $('.card').val();
        var price = $('.price').val();
        var date = $('#date').val();
        var area = $('.area').val();
        var hanzi = /^[\u4e00-\u9fa5]{0,}$/;
        var sfzh = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
        var shouru = /^[0-9]+(.[0-9]{3})?$/;

        if ((!hanzi.test(name)) || name == '') {
            mui.toast('请检查您的姓名');
            return;
        } else if ((!sfzh.test(card)) || card == '') {
            mui.toast('请检查您的身份证号');
            return;
        } else if ((!shouru.test(price)) || price == '') {
            mui.toast('请检查您的借款金额');
            return;
        } else if (date == '' || area == '') {
            mui.toast('请检查您输入的信息');
            return;
        } else {
            if (localStorage.dk_type == 1) { // 垫资服务
                a();
            } else {
                b();
            }
        }

        function a() {
            $.ajax({
                url: ur + 'rest/loanController/request',
                type: "post",
                dataType: "json",
                headers: {
                    "X-Token": localStorage.token
                },
                data: {
                    loanCode: 'aj',
                    evaluateId: localStorage.evaluateId,
                    point: (localStorage.locationPoint ? localStorage.locationPoint : ''), // 坐标
                    params: '{"name":"' + name + '","id_card":"' + card + '","price":"' + price + '","date":"' + date + '","area":"' + area + '","freeService":"中介服务"}'
                },
                success: function (data) {
                    //打开关于页面
                    href('askfor3-aj.html', 'askfor3-aj');
                }
            })
        }

        function b() {
            $.ajax({
                url: ur + 'rest/quickLoanController/quick-request',
                type: "post",
                dataType: "json",
                headers: {
                    "X-Token": localStorage.token
                },
                data: {
                    loanCode: 'aj',
                    partnerId: localStorage.fast_partner,
                    quickId: localStorage.fast_id,
                    evaluateId: localStorage.evaluateId,
                    params: '{"name":"' + name + '","id_card":"' + card + '","price":"' + price + '","date":"' + date + '","area":"' + area + '","freeService":"中介服务"}'
                },
                success: function (data) {
                    //打开关于页面
                    if (data.meta.code == 'S002') {
                        href('askfor3-aj.html', 'askfor3-aj');
                    }
                }
            });
        }
    });
</script>
</body>

</html>